<script type="text/javascript" src="<?php echo $this->webroot ?>/misc/js/tiny_mce/tiny_mce.js"></script>
<link type="text/css" rel="stylesheet" media="all" href="<?php echo $this->webroot ?>/misc/js/jscalendar-1.0/calendar-system.css" />
<script type="text/javascript" src="<?php echo $this->webroot ?>/misc/js/jscalendar-1.0/calendar_stripped.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot ?>/misc/js/jscalendar-1.0/calendar-setup_stripped.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot ?>/misc/js/jscalendar-1.0/lang/cn_utf8.js"></script>
<script type="text/javascript">
    tinyMCE.init({
      mode : "exact",
      elements : "content",
      width : "100%",
      plugins: "table,advimage,advlink,paste,searchreplace,inlinepopups",
      theme: "advanced",
      theme_advanced_toolbar_location: "top",
      theme_advanced_toolbar_align: "left",
      theme_advanced_statusbar_location : "bottom",
      theme_advanced_resizing : true,
      theme_advanced_resize_horizontal : false,
      theme_advanced_buttons1:
      "justifyleft,justifycenter,justifyright,justifyfull,|,bold,italic,strikethrough,|,forecolor,backcolor,|,sub,sup,|,charmap|,formatselect,fontselect,fontsizeselect",
      theme_advanced_buttons2:
      "bullist,numlist,|,outdent,indent,|,search,replace,|,undo,redo,|,link,unlink,image,flash,|,paste,pastetext,pasteword,|,cleanup,removeformat,|,code",
      theme_advanced_buttons3: "",
      extended_valid_elements: "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
      relative_urls: false,
      debug: false
    });
    tinyMCE.init({
      mode : "exact",
      elements : "description",
      width : "100%",
      plugins: "table,advimage,advlink,paste,inlinepopups,fullscreen",
      theme: "advanced",
      theme_advanced_toolbar_location: "top",
      theme_advanced_toolbar_align: "left",
      theme_advanced_buttons1: "justifyleft,justifycenter,justifyright,justifyfull,|,undo,redo,|,bold,italic,strikethrough,|,fullscreen",
      theme_advanced_buttons2: "",
      theme_advanced_buttons3: "",
      relative_urls: false,
      debug: false
    });
</script>

<div class="wrap">
<h2 id="write-post">下载管理</h2>

<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo url_for('admin/m/index/edit') ?>">
<input type="hidden" name="id" value="<?php echo $article->getId()?>" />

<div id="poststuff">

<div id="moremeta">
<div id="grabit" class="dbx-group">
<fieldset id="commentstatusdiv" class="dbx-box">
<h3 class="dbx-handle">状态</h3>
<div class="dbx-content">
<label for="state_1" class="selectit">
  <input type="radio" name="state" id="state_1" value="1" <?php if ($article->getStatus() == 1) echo 'checked="checked"' ?> />
  已发布
</label>
<label for="state_0" class="selectit">
  <input type="radio" name="state" id="state_0" value="0" <?php if ($article->getStatus() == 0) echo 'checked="checked"' ?> />
  未发布
</label>
</div>

</fieldset>

<fieldset class="dbx-box">
<h3 class="dbx-handle">分类</h3>
<div class="dbx-content">
<label for="recommend_1" class="selectit">
  <select name="cate_id">
     <?php foreach($cate as $r => $v): ?>
      <option value="<?php echo $v->getId();?>" checked=<?php if($v->getId()==$article->getCateId()){ echo 'true';}?>><?php echo $v->getTitle();?></option>
    <?php endforeach;?>
  </select>
</label>
</div>
</fieldset>

<!--fieldset id="authordiv" class="dbx-box">
<h3 class="dbx-handle">作者</h3>
<div class="dbx-content">
<input type="text" name="author" id="author" value="<?php echo $article->getAuthor() ?>" />
</div>

</fieldset-->

<fieldset id="created_atdiv" class="dbx-box">
<h3 class="dbx-handle">日期</h3>
<div class="dbx-content">
<input type="text" name="add_time" id="add_time" value="<?php echo date('Y-m-d H:i:s', $article->getAddTime()) ?>" />
<button id="trigger">...</button>
<script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "add_time",         // ID of the input field
      ifFormat    : "%Y-%m-%d %H:%M:%S",    // the date format
      showsTime      :    true,
      button      : "trigger"       // ID of the button
    }
  );
</script>
</div>

</fieldset>

</div>
</div>

<fieldset id="titlediv">
  <legend>标题：</legend>
  <div><input type="text" name="title" size="30" tabindex="1" value="<?php echo $article->getTitle() ?>" id="title" /></div>
</fieldset>
  <legend>别名：</legend>
  <div><input type="text" name="down_name" size="30" tabindex="1" value="<?php echo $article->getDownName() ?>" id="down_name" /></div>

<fieldset id="postdivrich">
  <legend>下载介绍：</legend>
  <div><textarea rows='15' cols='40' name='content' tabindex='2' id='content'><?php echo $article->getContent() ?></textarea></div>
</fieldset>
<fieldset id="postdivrich">
  <legend>下载介绍：</legend>
  <div><textarea rows='15' cols='40' name='description' tabindex='2' id='description'><?php echo $article->getDescription() ?></textarea></div>
</fieldset>

<fieldset id="tagdiv">
    <legend>标签：</legend>
    <div><input type="text" name="tags" id="tags" size="30" tabindex="3" value="<?php echo $article->getTags() ?>" /></div>
</fieldset>
<fieldset id="tagdiv">
    <legend>关键字：</legend>
    <div><input type="text" name="key_word" id="key_word" size="30" tabindex="3" value="<?php echo $article->getKeyWord() ?>" /></div>
</fieldset>


    <div id="advancedstuff" class="dbx-group">
        <fieldset class="dbx-box">
            <div class="dbx-h-andle-wrapper">
                <h3 class="dbx-handle">下载地址</h3>
            </div>
            <div class="dbx-c-ontent-wrapper">
                <div class="dbx-content"><input name="pic" type="file" id="pic" size="50" /><input name="" type="button"  value="上传"/>
                </div>
            </div>
        </fieldset>

        <fieldset class="dbx-box">
            <div class="dbx-h-andle-wrapper">
                <h3 class="dbx-handle">下载链接：</h3>
            </div>
            <div class="dbx-c-ontent-wrapper">
                <div class="dbx-content">
                    本地下载：<input type="text" name="local_url" id="local_url" size="50" value="<?php echo $article->getLocalUrl() ?>" /><br/>
                    115网盘：<input type="text" name="u115_url" id="u115_url" size="50" value="<?php echo $article->getU115Url() ?>" /><br/>
                    数据银行：<input type="text" name="dbank_url" id="dbank_url" size="50" value="<?php echo $article->getDbankUrl() ?>" /><br/>
                </div>
            </div>
        </fieldset>
    </div>
<p class="submit">
<input type="submit" name="submit" value="提交" style="font-weight: bold;" tabindex="4" />
</p>
</div>
</form>

</div>